<template>
    <div class="edit">
        <!-- 头部搜索 -->
        <header>
            <div class="filter-part">
                <span class="span">&nbsp;城市：{{detalisall.provinceEnd}}&nbsp;&nbsp;{{detalisall.cityFrom}}</span>
            </div>
        </header>
        <Row>
            <Col span="6">
                <div class='wrapper' v-for="(item,index) in lista"
                    :key="index">
                    <span class ='name'>{{item.title}}：</span>
                    <iSwitch size="large" v-model="item.status" :disabled="disabled">
                        <span slot="open">是</span>
                        <span slot="close">否</span>
                    </iSwitch>
                </div>
            </Col>
            <Col span="18">
                <Form :label-width="200" style="margin-bottom:-24px;">
                    <FormItem label="患者支付的配送费统一为" v-if="detalisall.isUnifiedFee==1">
                        <input type="number" placeholder="请输入或查看" readyonly v-model="detalisall.unifiedMoney" class="otherinput" disabled="disabled">
                        <small>元/单</small>
                    </FormItem>
                </Form>
            </Col>
        </Row>
         <Row>
            <Col span="6">
                <div class='wrapper' v-for="(item,index) in listb"
                    :key="index">
                    <span class ='name'>{{item.title}}：</span>
                    <iSwitch size="large" v-model="item.status" :disabled="disabled">
                        <span slot="open">是</span>
                        <span slot="close">否</span>
                    </iSwitch>
                </div>
            </Col>
            <Col span="18">
                <Form :label-width="200" style="margin-top:5px;">
                    <FormItem label="包邮条件：设置订单药品总价超过" v-if="detalisall.isFreeShipping==1">
                    <input type="number" @keydown="handleInput2" placeholder="请输入或查看" disabled="disabled" v-model="detalisall.freeFromMoney" class="otherinput">
                    <small>元包邮</small>
                    </FormItem>
                </Form>
            </Col>
        </Row>
        <Row>
            <Col span="5">
                <span class="span">&nbsp;签约快递公司</span>
            </Col>
        </Row>
        <Table border ref="selection" :columns="columns4" :data="Companylist"></Table>
        <br>
        <div style="text-align:center">
            <Button  @click="back" style="margin-left: 8px;">
                <i class = "iconfont icon-butongyi" style="font-size:14px;margin-right:5px"></i>返回
            </Button>
        </div>
    </div>
</template>
<script>
    import api from "@/api/commonApi";
    export default {
        data () {
            return {
                statusa:false,
                statusb:false,
                disabled: true,
                lista: [
                    {
                        title: "是否统一快递费",
                        status: false
                    }
                ],
                listb: [
                    {
                        title: "是否包邮",
                        status: false
                    }
                ],
                columns4: [
                    {type: 'index', title: '排序', width: 80, align: 'center'},
                    {
                        title: '快递公司',
                        key: 'expressCompanyName',
                        align: 'center',
                        width: 150,
                    },
                    {
                        title: '官方收费标准',
                        align: 'center',
                        children: [
                            {
                                title: '每单价格/元',
                                key: 'price',
                                align: 'center',
                            },
                            {
                                title: '收费说明',
                                key: 'remark',
                                align: 'center',
                            }
                        ]
                    },
                ],
                Companylist: [],
                detalisall:{}
            }
        },
        created(){
            let breadList = [
            { path: "/index", title: "首页" },
            {
                path: "",
                title: "系统运营参数配置"
            },
            {
                path: "/index/drugfirmsmanage/deliverycharge/samecity/details",
                title: "同城配送详情"
            }
            ];
            this.$emit("changeBreadList", breadList);
            this.getdetails()
        },
        methods: {
            //获取详情
            getdetails(){
                this.$axios.post(api.findDistributionById,{id: this.$route.query.id}).then(res => {
                    if (res.data.code === 1) {
                       this.detalisall = res.data.object
                       this.Companylist = res.data.object.feeList
                       if(this.detalisall.isFreeShipping == 0){
                            this.listb[0].status = false
                        }else{
                            this.listb[0].status = true
                        }
                        if(this.detalisall.isUnifiedFee == 0){
                            this.lista[0].status = false
                        }else{
                            this.lista[0].status = true
                        }
                    } else {
                        this.$Message.error('请求异常');
                        return false;
                    }
                }).catch(() => {
                    this.loading = false;
                });
            },
            //返回
            back(){
                this.functionJS.queryNavgationTo(this,"/index/drugfirmsmanage/deliverycharge/samecity/list");
            },
        }
    }
</script>
<style scoped lang="less">
    .edit {
        width: 100%;
        min-width: 1200px;
        padding: 10px;
        margin: 0 auto;
        background: #fff;
        .wrapper{
            width:100%;
            height:30px;
            display:flex;
            flex-direction:row;
            align-items:center;
            padding:0 5px;
            margin:5px 0;
            font-size: 12px;
            .name {
                min-width:200px;
            }
        }
        header {
            width: 100%;
            .filter-part {
                display: flex;
                flex-wrap: wrap;
                .filter-item {
                    display: flex;
                    margin: 10px 10px 10px 0;
                    label {
                        white-space: nowrap;
                        line-height: 32px;
                        width: 100px;
                        text-align: right;
                    }
                    .input {
                        width: 220px;
                    }
                    .select {
                        width: 70px;
                    }
                }
                .filter-btn-group {
                    margin: 10px 10px 10px 0;
                    flex: 0 0 auto;
                }
            }
            .fun-part {
                margin-top: 15px;
                margin-bottom: 10px;
                a {
                    vertical-align: bottom;
                }
            }
        }
        .ml{
            margin-left: -157px;
        }
        small{
            color:#333;
            font-size: 12px;   
        }
        .span{
            color:#666;
            font-size: 12px;
            line-height: 50px;
            margin-left: -5px;
            b{
                color: red;
            }
        }
        p{
            line-height: 40px;
            b{
                color: red;
            }
        }
        .ye{
            color:#FF9933;
            font-size: 12px;
        }
        .otherinput{
            width: 15%;
            display: inline-block;
            height: 32px;
            line-height: 1.5;
            padding: 4px 7px;
            font-size: 12px;
            border: 1px solid #dddee1;
            border-radius: 4px;
            color: #495060;
            background-color: #fff;
            background-image: none;
            position: relative;
            cursor: text;
            outline: none;
            background: #f5f5f5;
        }
    }
</style>
